package com.huatai.exchange.send;

import com.faneui.common.exception.BusinessException;
import com.huatai.exchange.facade.CommunicationConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class FileSendFactory {

    @Autowired
    private FileSendService fileMailSendService;

    @Autowired
    private FileSendService fileSztSendService;

    @Autowired
    private FileSendService fileSmbSendService;

    @Autowired
    private FileSendService fileFtpSendService;

    public FileSendService getSendService(String sendType) throws BusinessException {
        if (CommunicationConstants.COMMUNICATION_MAIL.equals(sendType)) { // http 获取文件
            return fileMailSendService;
        } else if (CommunicationConstants.COMMUNICATION_SZT.equals(sendType)) {
            return fileSztSendService;
        } else if (CommunicationConstants.COMMUNICATION_SMB.equals(sendType)) {
            return fileSmbSendService;
        } else if (CommunicationConstants.COMMUNICATION_FTP.equals(sendType)) {
            return fileFtpSendService;
        } else {
            throw new BusinessException("无效沟通类型");
        }
    }

}
